<template>
  <!-- 内部机构维护详情-->
  <el-dialog
    :title="title"
    center
    :visible.sync="openState"
    width="1024px"
    :close-on-click-modal="false"
  >
    <el-form ref="detailForm" :model="detailForm" :disabled = "true" :rules="detailRules" label-width="110px">
      <!--关联内部机构信息-->
      <el-card class="form-card orgInfo-card">
        <div slot="header" class="label-header-msg">
          <span></span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="内部机构号" prop="brno">
              <el-input
                v-model="detailForm.brno"
                placeholder="内部机构号"
                :disabled = "true"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="内部机构名称" prop="brname">
              <el-input
                v-model="detailForm.brname"
                placeholder="内部机构名称"
                :disabled = "true"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!--内部机构维护详情-->
      <el-card class="form-card chnlInfo-card">
        <div slot="header" class="label-header-msg">
          <span></span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="渠道" prop="sysType">
              <el-select
                v-model="detailForm.sysType"
                placeholder="渠道"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dictMap.ORGAN_SYSTYPE_BRANCH"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="渠道系统状态" prop="curSysStatus">
              <el-select
                v-model="detailForm.curSysStatus"
                placeholder="渠道系统状态"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dictMap.SYSTEMSTATUS"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="渠道系统日期" prop="curSysDate">
              <el-date-picker v-model="detailForm.curSysDate" style="width: 100%;" type="date" value-format="yyyyMMdd"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="接入点" prop="accessPoint">
              <el-select
                v-model="detailForm.accessPoint"
                placeholder="接入点"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dictMap.ACCESS_POINT"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

      <!--参与行信息-->
      <el-card class="form-card bankInfo-card">
        <div slot="header" class="label-header-msg">
          <span></span>
        </div>
        <el-row>
          <el-col :span="12">
            <el-form-item label="参与行行号" prop="bankCode">
              <el-input
                v-model="detailForm.bankCode"
                placeholder="参与行行号"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="参与行行名" prop="orgFullName">
              <el-input
                v-model="detailForm.orgFullName"
                placeholder="参与行行名"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="12">
            <el-form-item label="参与机构类别" prop="bankType">
              <el-select
                v-model="detailForm.bankType"
                placeholder="参与机构类别"
                style="width: 100%"
              >
                <el-option
                  v-for="dict in dictMap.PT_TYPE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="清算行行号" prop="drctBankCode">
              <el-input
                v-model="detailForm.drctBankCode"
                placeholder="清算行行号"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <el-form-item label="清算行行名" prop="drctBankName">
              <el-input
                v-model="detailForm.drctBankName"
                placeholder="清算行行名"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所在城市代码" prop="lglCtCode">
              <el-input
                v-model="detailForm.lglCtCode"
                placeholder="所在城市代码"
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所属CPCC" prop="lglCcpc">
              <el-input
                v-model="detailForm.lglCcpc"
                placeholder="所属CPCC"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-card>

    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="cancel">关 闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { queryBrnoDetail,reqConfigRelaBrnoList} from "@/api/cnaps/bizMng/brnoBind.js";
import { listPageMixin } from "@/libs/listPageMixin";

export default {
  name: "brnoDetail",
  mixins: [listPageMixin],
  components: {
  },
  data() {
    return {
      reqConfig: reqConfigRelaBrnoList,
       // 查询参数
       queryParams: {
        sysType: "",
        bankCode: "",
      },
      title: "",
      // 是否显示弹出层
      openState: false,
      // 字段可编辑控制

      //数据字典
      searchFormDictList: [
        "ORGAN_SYSTYPE_BRANCH",
        "SYSTEMSTATUS",
        "ACCESS_POINT",
        "PT_TYPE",
      ],
      // 表单参数
      detailForm:{},
      // 表单校验
      detailRules: {
        sysType: [{ required: true, disabled: true, message: "请选择渠道", trigger: "blur" }],
        curSysStatus: [{ required: true, disabled: true, message: "请选择渠道系统状态", trigger: "blur" }],
        curSysDate: [{ required: true, disabled: true, message: "请选择渠道系统日期", trigger: "blur" }],
        accessPoint: [{ required: true, disabled: true, message: "请输入接入点", trigger: "blur" }],

        brno: [{ required: true, message: "请输入内部机构", trigger: "blur" }],
        brname: [{ required: true, message: "请输入内部机构名称", trigger: "blur" }],
        bankCode: [{ required: true, disabled: true, message: "请输入参与行行号", trigger: "blur" }],
        orgFullName: [{ required: true, disabled: true, message: "请输入参与行行名", trigger: "blur" }],
        bankType: [{ required: true, disabled: true, message: "请选择参与机构类别", trigger: "blur" }],
        drctBankCode: [{ required: true, disabled: true, message: "请输入清算行行号", trigger: "blur" }],
        drctBankName: [{ required: true, disabled: true, message: "请输入清算行行名", trigger: "blur" }],
        lglCtCode: [{ required: true, disabled: true, message: "请输入所在城市代码", trigger: "blur" }],
        lglCcpc: [{ required: true, disabled: true, message: "请输入所属CPCC", trigger: "blur" }],
      },
      opButtonList: () => {
        return [
        ];
      },
      tableBindColumns: [
        { label: `内部机构号`, prop: "brno", width: "460px" },
        { label: `内部机构名称`, prop: "brname", width: "460px" },
      ],
    };
  },
  mounted() {
  },
  methods: {
    // 表单重置
    reset() {
      this.resetForm("detailForm");
      this.$set(this, "detailForm", {});
    },
    // 关闭回掉
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then(_ => {
          this.reset();
          done();
        })
        .catch(_ => {});
    },
    show(row) {
      this.detailForm = row;
      this.title = "内部机构维护明细";
      this.openState = true;
      this.queryParams.sysType = row.sysType;
      this.queryParams.bankCode = row.bankCode;
      this.queryBrnoDetail(row);
    },

    queryBrnoDetail: function(row) {
      queryBrnoDetail(row).then(response => {
          this.detailForm = response.result;
        })
    },

    cancel() {
      this.openState = false;
      this.reset();
      this.$emit("editComplete", true);
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
